package com.example.work.controller;

import com.example.work.entity.Buy;
import com.example.work.entity.UserEntity;
import com.example.work.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;



/**
 * Description:    Usercontroller
 * Author:         JinMu
 * CreateDate:     2018/3/2 10:31
 * Version:        1.0
 */
@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping(value = "/login")
    public String run(Model model){
        return "login";
    }

    @GetMapping(value = "/submit")
    public String submit(Model model){
        UserEntity userEntity = new UserEntity();
        Buy buy = new Buy();
        model.addAttribute("buy",buy);
        model.addAttribute("userEntity",userEntity);
        return "buy";
    }
    @GetMapping("/submit_s")
    public String submit_s(Model model){
        UserEntity userEntity = new UserEntity();
        Buy buy = new Buy();
        model.addAttribute("buy",buy);
        model.addAttribute("userEntity",userEntity);
        return "buy_s";
    }
    @GetMapping(value = "/index")
    public String index(){
        return "index";
    }
    @GetMapping(value = "/welcome")
    public String welocme(){
        return "welcome";
    }
}